//auto gen by paipai.java.augogen ver 3.0.0
//author skyzhuang
//source idl: com.erp.gis.idl.GisMapGatewayAo.java


#ifndef ERP_GIS_PO_CADDRCOORDINATERESULTPO_BY_AUTOGEN_V5_H
#define ERP_GIS_PO_CADDRCOORDINATERESULTPO_BY_AUTOGEN_V5_H


#include "app_platform/intf_serializable.h"
#include <map>
#include "erp/gis/po/coordinatespo_gis.h"
#include <string>
#include <sstream>
#include <iostream>


namespace erp
{
namespace gis
{
namespace po
{


class CAddrCoordinateResultPo : public ISerializable
{
	public:
		std::string m_sLastErrMsg;///<错误信息

		/**
		 *  版本号 
		 *
		 * 版本 >= 0
		 */
		uint32_t dwVersion;

		/**
		 * 版本 >= 0
		 */
		uint8_t cVersion_u;

		/**
		 * 地图API类型对应经纬度列表
		 *
		 * 版本 >= 0
		 */
		std::map<uint32_t,std::vector<erp::gis::po::CCoordinatesPo> >  mapApiType2Coordinates;

		/**
		 * 版本 >= 0
		 */
		uint8_t cApiType2Coordinates_u;

		/**
		 * 最匹配经纬度
		 *
		 * 版本 >= 0
		 */
		erp::gis::po::CCoordinatesPo oClosestCoordinate;

		/**
		 * 版本 >= 0
		 */
		uint8_t cClosestCoordinate_u;

		/**
		 * 尝试过次数(尝试过一定次数后,将不在从地图中寻找经纬度)
		 *
		 * 版本 >= 0
		 */
		uint32_t dwAlreadyRetryNum;

		/**
		 * 版本 >= 0
		 */
		uint8_t cAlreadyRetryNum_u;

		/**
		 * 信用级别
		 *
		 * 版本 >= 0
		 */
		uint32_t dwTrustLevel;

		/**
		 * 版本 >= 0
		 */
		uint8_t cTrustLevel_u;

		/**
		 * 最后修改时间
		 *
		 * 版本 >= 0
		 */
		uint64_t ddwLastUpdateTime;

		/**
		 * 版本 >= 0
		 */
		uint8_t cLastUpdateTime_u;

		/**
		 * 预留扩展字段 
		 *
		 * 版本 >= 0
		 */
		std::string strReserve;

		/**
		 * 版本 >= 0
		 */
		uint8_t cReserve_u;




	public:
		CAddrCoordinateResultPo():
		dwVersion(0),
		cVersion_u(0),
		cApiType2Coordinates_u(0),
		cClosestCoordinate_u(0),
		dwAlreadyRetryNum(0),
		cAlreadyRetryNum_u(0),
		dwTrustLevel(0),
		cTrustLevel_u(0),
		ddwLastUpdateTime(0),
		cLastUpdateTime_u(0),
		cReserve_u(0) {}
				CAddrCoordinateResultPo& operator = (const CAddrCoordinateResultPo& obj){

			this->dwVersion = obj.dwVersion;
			this->cVersion_u = obj.cVersion_u;
			this->mapApiType2Coordinates = obj.mapApiType2Coordinates;
			this->cApiType2Coordinates_u = obj.cApiType2Coordinates_u;
			this->oClosestCoordinate = obj.oClosestCoordinate;
			this->cClosestCoordinate_u = obj.cClosestCoordinate_u;
			this->dwAlreadyRetryNum = obj.dwAlreadyRetryNum;
			this->cAlreadyRetryNum_u = obj.cAlreadyRetryNum_u;
			this->dwTrustLevel = obj.dwTrustLevel;
			this->cTrustLevel_u = obj.cTrustLevel_u;
			this->ddwLastUpdateTime = obj.ddwLastUpdateTime;
			this->cLastUpdateTime_u = obj.cLastUpdateTime_u;
			this->strReserve = obj.strReserve;
			this->cReserve_u = obj.cReserve_u;
			return *this;
		}

	public:


		/**
		 * 是否设置 版本号 了
		 * 
		 * @param uint32_t:dwVersion
		 *  
		 * 
		 */
		 bool  IsVersionSet() const{
				 return  cVersion_u != 0;
		}


		/**
		 * 获取uflag 版本号 了
		 * 
		 * @param uint32_t:dwVersion
		 *  
		 * 
		 */
		 const uint8_t   GetVersionUFlag() const{
				 return  cVersion_u;
		}


		/**
		 * 设置 版本号 
		 * 
		 * @param uint32_t:dwVersion
		 *  
		 * 
		 */
		 void  SetVersion( const uint32_t& sVal, uint8_t cUFlag=1){
				dwVersion = sVal;
				cVersion_u = cUFlag;
		}


		/**
		 * 获取 版本号 
		 * 
		 * @return dwVersion value 类型为:uint32_t
		 * 
		 */
		 const uint32_t&  GetVersion() const {
				return dwVersion;
		}


		/**
		 * 设置
		 * 
		 * 此字段的版本 >= 1
		 * @param uint8_t:cVersion_u
		 *  
		 * 
		 */
		 void  SetVersion_u( const uint8_t& sVal){
				cVersion_u = sVal;
		}


		/**
		 * 获取
		 * 
		 * @return cVersion_u value 类型为:uint8_t
		 * 
		 */
		 const uint8_t&  GetVersion_u() const {
				return cVersion_u;
		}


		/**
		 * 是否设置地图API类型对应经纬度列表了
		 * 
		 * @param std::map<uint32_t,std::vector<erp::gis::po::CCoordinatesPo> > :mapApiType2Coordinates
		 *  
		 * 
		 */
		 bool  IsApiType2CoordinatesSet() const{
				 return  cApiType2Coordinates_u != 0;
		}


		/**
		 * 获取uflag地图API类型对应经纬度列表了
		 * 
		 * @param std::map<uint32_t,std::vector<erp::gis::po::CCoordinatesPo> > :mapApiType2Coordinates
		 *  
		 * 
		 */
		 const uint8_t   GetApiType2CoordinatesUFlag() const{
				 return  cApiType2Coordinates_u;
		}


		/**
		 * 设置地图API类型对应经纬度列表
		 * 
		 * @param std::map<uint32_t,std::vector<erp::gis::po::CCoordinatesPo> > :mapApiType2Coordinates
		 *  
		 * 
		 */
		 void  SetApiType2Coordinates( const std::map<uint32_t,std::vector<erp::gis::po::CCoordinatesPo> > & sVal, uint8_t cUFlag=1){
				mapApiType2Coordinates = sVal;
				cApiType2Coordinates_u = cUFlag;
		}


		/**
		 * 获取地图API类型对应经纬度列表
		 * 
		 * @return mapApiType2Coordinates value 类型为:std::map<uint32_t,std::vector<erp::gis::po::CCoordinatesPo> > 
		 * 
		 */
		 const std::map<uint32_t,std::vector<erp::gis::po::CCoordinatesPo> > &  GetApiType2Coordinates() const {
				return mapApiType2Coordinates;
		}


		/**
		 * 获取地图API类型对应经纬度列表
		 * 
		 * @return mapApiType2Coordinates value 类型为:std::map<uint32_t,std::vector<erp::gis::po::CCoordinatesPo> > 
		 * 
		 */
		 std::map<uint32_t,std::vector<erp::gis::po::CCoordinatesPo> > &  GetApiType2Coordinates() {
				return mapApiType2Coordinates;
		}


		/**
		 * 设置
		 * 
		 * 此字段的版本 >= 1
		 * @param uint8_t:cApiType2Coordinates_u
		 *  
		 * 
		 */
		 void  SetApiType2Coordinates_u( const uint8_t& sVal){
				cApiType2Coordinates_u = sVal;
		}


		/**
		 * 获取
		 * 
		 * @return cApiType2Coordinates_u value 类型为:uint8_t
		 * 
		 */
		 const uint8_t&  GetApiType2Coordinates_u() const {
				return cApiType2Coordinates_u;
		}


		/**
		 * 是否设置最匹配经纬度了
		 * 
		 * @param erp::gis::po::CCoordinatesPo:oClosestCoordinate
		 *  
		 * 
		 */
		 bool  IsClosestCoordinateSet() const{
				 return  cClosestCoordinate_u != 0;
		}


		/**
		 * 获取uflag最匹配经纬度了
		 * 
		 * @param erp::gis::po::CCoordinatesPo:oClosestCoordinate
		 *  
		 * 
		 */
		 const uint8_t   GetClosestCoordinateUFlag() const{
				 return  cClosestCoordinate_u;
		}


		/**
		 * 设置最匹配经纬度
		 * 
		 * @param erp::gis::po::CCoordinatesPo:oClosestCoordinate
		 *  
		 * 
		 */
		 void  SetClosestCoordinate( const erp::gis::po::CCoordinatesPo& sVal, uint8_t cUFlag=1){
				oClosestCoordinate = sVal;
				cClosestCoordinate_u = cUFlag;
		}


		/**
		 * 获取最匹配经纬度
		 * 
		 * @return oClosestCoordinate value 类型为:erp::gis::po::CCoordinatesPo
		 * 
		 */
		 const erp::gis::po::CCoordinatesPo&  GetClosestCoordinate() const {
				return oClosestCoordinate;
		}


		/**
		 * 获取最匹配经纬度
		 * 
		 * @return oClosestCoordinate value 类型为:erp::gis::po::CCoordinatesPo
		 * 
		 */
		 erp::gis::po::CCoordinatesPo&  GetClosestCoordinate() {
				return oClosestCoordinate;
		}


		/**
		 * 设置
		 * 
		 * 此字段的版本 >= 1
		 * @param uint8_t:cClosestCoordinate_u
		 *  
		 * 
		 */
		 void  SetClosestCoordinate_u( const uint8_t& sVal){
				cClosestCoordinate_u = sVal;
		}


		/**
		 * 获取
		 * 
		 * @return cClosestCoordinate_u value 类型为:uint8_t
		 * 
		 */
		 const uint8_t&  GetClosestCoordinate_u() const {
				return cClosestCoordinate_u;
		}


		/**
		 * 是否设置尝试过次数(尝试过一定次数后,将不在从地图中寻找经纬度)了
		 * 
		 * @param uint32_t:dwAlreadyRetryNum
		 *  
		 * 
		 */
		 bool  IsAlreadyRetryNumSet() const{
				 return  cAlreadyRetryNum_u != 0;
		}


		/**
		 * 获取uflag尝试过次数(尝试过一定次数后,将不在从地图中寻找经纬度)了
		 * 
		 * @param uint32_t:dwAlreadyRetryNum
		 *  
		 * 
		 */
		 const uint8_t   GetAlreadyRetryNumUFlag() const{
				 return  cAlreadyRetryNum_u;
		}


		/**
		 * 设置尝试过次数(尝试过一定次数后,将不在从地图中寻找经纬度)
		 * 
		 * @param uint32_t:dwAlreadyRetryNum
		 *  
		 * 
		 */
		 void  SetAlreadyRetryNum( const uint32_t& sVal, uint8_t cUFlag=1){
				dwAlreadyRetryNum = sVal;
				cAlreadyRetryNum_u = cUFlag;
		}


		/**
		 * 获取尝试过次数(尝试过一定次数后,将不在从地图中寻找经纬度)
		 * 
		 * @return dwAlreadyRetryNum value 类型为:uint32_t
		 * 
		 */
		 const uint32_t&  GetAlreadyRetryNum() const {
				return dwAlreadyRetryNum;
		}


		/**
		 * 设置
		 * 
		 * 此字段的版本 >= 1
		 * @param uint8_t:cAlreadyRetryNum_u
		 *  
		 * 
		 */
		 void  SetAlreadyRetryNum_u( const uint8_t& sVal){
				cAlreadyRetryNum_u = sVal;
		}


		/**
		 * 获取
		 * 
		 * @return cAlreadyRetryNum_u value 类型为:uint8_t
		 * 
		 */
		 const uint8_t&  GetAlreadyRetryNum_u() const {
				return cAlreadyRetryNum_u;
		}


		/**
		 * 是否设置信用级别了
		 * 
		 * @param uint32_t:dwTrustLevel
		 *  
		 * 
		 */
		 bool  IsTrustLevelSet() const{
				 return  cTrustLevel_u != 0;
		}


		/**
		 * 获取uflag信用级别了
		 * 
		 * @param uint32_t:dwTrustLevel
		 *  
		 * 
		 */
		 const uint8_t   GetTrustLevelUFlag() const{
				 return  cTrustLevel_u;
		}


		/**
		 * 设置信用级别
		 * 
		 * @param uint32_t:dwTrustLevel
		 *  
		 * 
		 */
		 void  SetTrustLevel( const uint32_t& sVal, uint8_t cUFlag=1){
				dwTrustLevel = sVal;
				cTrustLevel_u = cUFlag;
		}


		/**
		 * 获取信用级别
		 * 
		 * @return dwTrustLevel value 类型为:uint32_t
		 * 
		 */
		 const uint32_t&  GetTrustLevel() const {
				return dwTrustLevel;
		}


		/**
		 * 设置
		 * 
		 * 此字段的版本 >= 1
		 * @param uint8_t:cTrustLevel_u
		 *  
		 * 
		 */
		 void  SetTrustLevel_u( const uint8_t& sVal){
				cTrustLevel_u = sVal;
		}


		/**
		 * 获取
		 * 
		 * @return cTrustLevel_u value 类型为:uint8_t
		 * 
		 */
		 const uint8_t&  GetTrustLevel_u() const {
				return cTrustLevel_u;
		}


		/**
		 * 是否设置最后修改时间了
		 * 
		 * @param uint64_t:ddwLastUpdateTime
		 *  
		 * 
		 */
		 bool  IsLastUpdateTimeSet() const{
				 return  cLastUpdateTime_u != 0;
		}


		/**
		 * 获取uflag最后修改时间了
		 * 
		 * @param uint64_t:ddwLastUpdateTime
		 *  
		 * 
		 */
		 const uint8_t   GetLastUpdateTimeUFlag() const{
				 return  cLastUpdateTime_u;
		}


		/**
		 * 设置最后修改时间
		 * 
		 * @param uint64_t:ddwLastUpdateTime
		 *  
		 * 
		 */
		 void  SetLastUpdateTime( const uint64_t& sVal, uint8_t cUFlag=1){
				ddwLastUpdateTime = sVal;
				cLastUpdateTime_u = cUFlag;
		}


		/**
		 * 获取最后修改时间
		 * 
		 * @return ddwLastUpdateTime value 类型为:uint64_t
		 * 
		 */
		 const uint64_t&  GetLastUpdateTime() const {
				return ddwLastUpdateTime;
		}


		/**
		 * 设置
		 * 
		 * 此字段的版本 >= 1
		 * @param uint8_t:cLastUpdateTime_u
		 *  
		 * 
		 */
		 void  SetLastUpdateTime_u( const uint8_t& sVal){
				cLastUpdateTime_u = sVal;
		}


		/**
		 * 获取
		 * 
		 * @return cLastUpdateTime_u value 类型为:uint8_t
		 * 
		 */
		 const uint8_t&  GetLastUpdateTime_u() const {
				return cLastUpdateTime_u;
		}


		/**
		 * 是否设置预留扩展字段 了
		 * 
		 * @param std::string:strReserve
		 *  
		 * 
		 */
		 bool  IsReserveSet() const{
				 return  cReserve_u != 0;
		}


		/**
		 * 获取uflag预留扩展字段 了
		 * 
		 * @param std::string:strReserve
		 *  
		 * 
		 */
		 const uint8_t   GetReserveUFlag() const{
				 return  cReserve_u;
		}


		/**
		 * 设置预留扩展字段 
		 * 
		 * @param std::string:strReserve
		 *  
		 * 
		 */
		 void  SetReserve( const std::string& sVal, uint8_t cUFlag=1){
				strReserve = sVal;
				cReserve_u = cUFlag;
		}


		/**
		 * 获取预留扩展字段 
		 * 
		 * @return strReserve value 类型为:std::string
		 * 
		 */
		 const std::string&  GetReserve() const {
				return strReserve;
		}


		/**
		 * 获取预留扩展字段 
		 * 
		 * @return strReserve value 类型为:std::string
		 * 
		 */
		 std::string&  GetReserve() {
				return strReserve;
		}


		/**
		 * 设置
		 * 
		 * 此字段的版本 >= 1
		 * @param uint8_t:cReserve_u
		 *  
		 * 
		 */
		 void  SetReserve_u( const uint8_t& sVal){
				cReserve_u = sVal;
		}


		/**
		 * 获取
		 * 
		 * @return cReserve_u value 类型为:uint8_t
		 * 
		 */
		 const uint8_t&  GetReserve_u() const {
				return cReserve_u;
		}

		virtual bool Serialize(CByteStreamNetwork& bs){
		
			uint32_t dwMyLen = 0;
			if(bs.isStoring()) //for write in buffer
			{
				//can not larger than 1 M.
				CByteStreamNetwork bsDummy(NULL, 1024 * 1024, false);
				//bsDummy for precheck the xo size...
				bsDummy.isStoring(true);
				Serialize_i(bsDummy);
				dwMyLen = bsDummy.getWrittenLength();
				bs & dwMyLen;
				Serialize_i(bs);
			}
			else
			{    //for read from buffer
				bs & dwMyLen;
				uint32_t dwReadedLen = bs.getReadLength();
				Serialize_i(bs);
				dwReadedLen = bs.getReadLength() - dwReadedLen;
				// dwReadedLen for the size of xo
				if( dwReadedLen > dwMyLen ){
					return false;
				}
				//go through the unwanted mem position...
				bs.goForward( dwMyLen - dwReadedLen );
			}

			return bs.isGood();
		}

		bool Serialize_i(CByteStreamNetwork& bsTmp){

			uint32_t dwVersionTmp = dwVersion;
			bsTmp & dwVersionTmp; // 序列化 版本号  类型为uint32_t
			bsTmp & cVersion_u; // 序列化 类型为uint8_t
			bsTmp & mapApiType2Coordinates; // 序列化地图API类型对应经纬度列表 类型为Map
			bsTmp & cApiType2Coordinates_u; // 序列化 类型为uint8_t
			bsTmp & oClosestCoordinate; // 序列化最匹配经纬度 类型为CoordinatesPo
			bsTmp & cClosestCoordinate_u; // 序列化 类型为uint8_t
			bsTmp & dwAlreadyRetryNum; // 序列化尝试过次数(尝试过一定次数后,将不在从地图中寻找经纬度) 类型为uint32_t
			bsTmp & cAlreadyRetryNum_u; // 序列化 类型为uint8_t
			bsTmp & dwTrustLevel; // 序列化信用级别 类型为uint32_t
			bsTmp & cTrustLevel_u; // 序列化 类型为uint8_t
			bsTmp & ddwLastUpdateTime; // 序列化最后修改时间 类型为uint64_t
			bsTmp & cLastUpdateTime_u; // 序列化 类型为uint8_t
			bsTmp & strReserve; // 序列化预留扩展字段  类型为String
			bsTmp & cReserve_u; // 序列化 类型为uint8_t
			return bsTmp.isGood();
		}

		const char* GetLastErrMsg() const{
			return m_sLastErrMsg.c_str();
		}

		bool VerifyAddrCoordinateResultPo(){

			if(!IsVersionSet()){
				m_sLastErrMsg = "Miss Param:version";
				return false;
			}

			if(!IsApiType2CoordinatesSet()){
				m_sLastErrMsg = "Miss Param:apiType2Coordinates";
				return false;
			}

			if(!IsClosestCoordinateSet()){
				m_sLastErrMsg = "Miss Param:closestCoordinate";
				return false;
			}

			if(!IsAlreadyRetryNumSet()){
				m_sLastErrMsg = "Miss Param:alreadyRetryNum";
				return false;
			}

			if(!IsTrustLevelSet()){
				m_sLastErrMsg = "Miss Param:trustLevel";
				return false;
			}

			if(!IsLastUpdateTimeSet()){
				m_sLastErrMsg = "Miss Param:lastUpdateTime";
				return false;
			}

			if(!IsReserveSet()){
				m_sLastErrMsg = "Miss Param:reserve";
				return false;
			}
			return true;
		}

		void DumpData(std::ostream& oss) const{
		
			oss<<"[dwVersion:"<<dwVersion<<"] ";
			oss<<"[cVersion_u:"<<(int)cVersion_u<<"] ";
		//嵌套内容有错误，建议使用dumpDataTree方法，复杂数据格式更直观！
			oss<<"[cApiType2Coordinates_u:"<<(int)cApiType2Coordinates_u<<"] ";
			oss<<"[oClosestCoordinate:";
			oClosestCoordinate.DumpData(oss);
			oss<<"] ";
			oss<<"[cClosestCoordinate_u:"<<(int)cClosestCoordinate_u<<"] ";
			oss<<"[dwAlreadyRetryNum:"<<dwAlreadyRetryNum<<"] ";
			oss<<"[cAlreadyRetryNum_u:"<<(int)cAlreadyRetryNum_u<<"] ";
			oss<<"[dwTrustLevel:"<<dwTrustLevel<<"] ";
			oss<<"[cTrustLevel_u:"<<(int)cTrustLevel_u<<"] ";
			oss<<"[ddwLastUpdateTime:"<<ddwLastUpdateTime<<"] ";
			oss<<"[cLastUpdateTime_u:"<<(int)cLastUpdateTime_u<<"] ";
			oss<<"[strReserve:"<<strReserve<<"] ";
			oss<<"[cReserve_u:"<<(int)cReserve_u<<"] ";
		
		}

		// codydeng提供,非常好的dump方法 ^-^  。。。。。
		template<typename T>
		T & DumpPlusData(T& oss){
			oss<<"dwVersion:"<<dwVersion;
			oss<<"cVersion_u:"<<cVersion_u;
			oss<<"mapApiType2Coordinates:"<<mapApiType2Coordinates;
			oss<<"cApiType2Coordinates_u:"<<cApiType2Coordinates_u;
			oss<<"oClosestCoordinate:"<<oClosestCoordinate;
			oss<<"cClosestCoordinate_u:"<<cClosestCoordinate_u;
			oss<<"dwAlreadyRetryNum:"<<dwAlreadyRetryNum;
			oss<<"cAlreadyRetryNum_u:"<<cAlreadyRetryNum_u;
			oss<<"dwTrustLevel:"<<dwTrustLevel;
			oss<<"cTrustLevel_u:"<<cTrustLevel_u;
			oss<<"ddwLastUpdateTime:"<<ddwLastUpdateTime;
			oss<<"cLastUpdateTime_u:"<<cLastUpdateTime_u;
			oss<<"strReserve:"<<strReserve;
			oss<<"cReserve_u:"<<cReserve_u;
			return oss;
		}

		// wileywang提供,树形dump方法 ^-^  。。。。。
		void DumpDataTree(std::ostream& os, int ident = 0)const {
			g_pprint(os, "dwVersion", dwVersion, ident);
			g_pprint(os, "cVersion_u", cVersion_u, ident);
			g_pprint(os, "mapApiType2Coordinates", mapApiType2Coordinates, ident);
			g_pprint(os, "cApiType2Coordinates_u", cApiType2Coordinates_u, ident);
			g_pprint(os, "oClosestCoordinate", oClosestCoordinate, ident);
			g_pprint(os, "cClosestCoordinate_u", cClosestCoordinate_u, ident);
			g_pprint(os, "dwAlreadyRetryNum", dwAlreadyRetryNum, ident);
			g_pprint(os, "cAlreadyRetryNum_u", cAlreadyRetryNum_u, ident);
			g_pprint(os, "dwTrustLevel", dwTrustLevel, ident);
			g_pprint(os, "cTrustLevel_u", cTrustLevel_u, ident);
			g_pprint(os, "ddwLastUpdateTime", ddwLastUpdateTime, ident);
			g_pprint(os, "cLastUpdateTime_u", cLastUpdateTime_u, ident);
			g_pprint(os, "strReserve", strReserve, ident);
			g_pprint(os, "cReserve_u", cReserve_u, ident);
		}
		
		//提供ToString借口，默认为DumpData格式，请按需要进行修改
		std::string ToString() const{
			std::stringstream ss;
			DumpData(ss);
			return ss.str();
		}

/**
 ********************以下信息是每个版本的字段********************
 */

};

}
}
}

#endif /* ERP_GIS_PO_CADDRCOORDINATERESULTPO_BY_AUTOGEN_V5_H */
